package com.wosai.register.util;

import java.io.IOException;
import java.util.Collection;

import com.fasterxml.jackson.databind.ObjectMapper;

//input and output:  
//{  
//"animals":  
//[  
//  {"type":"dog","name":"Spike"},  
//  {"type":"cat","name":"Fluffy"}  
//]  
//}  


public class RunMapper {
    public static String input = " { \"animals\": [ {\"type\":\"dog\", \"name\":\"Spike\"}, {\"type\":\"cat\", \"name\":\"Fluffy\" } ] }";
    
    /**
     * @param args
     */
    public static void main(String[] args) throws IOException {
        ObjectMapper mapper = new ObjectMapper();  
        Zoo zoo =   
          mapper.readValue(input, Zoo.class);  
        System.out.println(mapper.writeValueAsString(zoo));  
    }

}

  
class Zoo  
{  
  public Collection<Animal> animals;  
}  
  
class Animal  
{  
  public String type;  
  public String name;  
}
